package com.company.project.service.impl;

import com.company.project.dao.UserRoleMapper;
import com.company.project.model.User;
import com.company.project.model.UserRole;
import com.company.project.service.UserRoleService;
import com.company.project.core.AbstractService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;


/**
 * Created by CodeGenerator on 2018/10/08.
 */
@Service
@Transactional
public class UserRoleServiceImpl extends AbstractService<UserRole> implements UserRoleService {
    @Resource
    private UserRoleMapper userRoleMapper;

    /**
     * 修改用户角色
     * @param user
     * @return
     */
    @Override
    public Boolean upUserRole(User user) {
        return userRoleMapper.upUserRole(user);
    }

    @Override
    public Boolean insertUserRole(User user) {
        return userRoleMapper.insertUserRole(user);
    }

    @Override
    public Boolean deleteUserRole(Integer id) {
        return userRoleMapper.deleteUserRole(id);
    }

    /**
     * 查询当前权限下用户的数量
     * @param rid
     * @return
     */
    @Override
    public Integer selectURCount(Integer rid) {
        return userRoleMapper.selectURCount(rid);
    }
}
